package org.jackysoft.struts2.portal;
import java.util.Collection;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.annotations.Logger;
import org.jackysoft.entity.nosql.Rules;
import org.jackysoft.service.RulesService;
import org.jackysoft.struts2.UtilsCRUDAction;
import org.jackysoft.util.OperationType;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;


@Controller
@Namespace("/rules")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Logger(label="制度",logType=OperationType.User)
public class RulesAction 
extends UtilsCRUDAction<Rules> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -8288629459963718249L;
	private RulesService service;
	private Rules bean;
	private Collection<Rules> beans;
    
	public String add() throws Exception{
		service.create(bean, upLoad, upLoadFileName);
		return SUCCESS;
	}
	
	public String search() throws Exception{
		beans =  service.search(search);
	    return SUCCESS;
	}
	
	public String reindex() throws Exception{
		service.reindex();
		return SUCCESS;
	}
	
	
	public void setBean(Rules bean){
	     this.bean = bean;
	}
	public Rules getBean(){
	     return this.bean;
	}
	public void setBeans(Collection<Rules> beans){
	
	     this.beans = beans;
	}
	public Collection<Rules> getBeans(){
	     return this.beans;
	}
	
	@Resource
	public void setService(RulesService service) {
		this.service = service;
		this.setDataProvider(service);
	}	
	
	public RulesService getService(){
	   return this.service;
	}
		
}